<?php
/**
 * Created by PhpStorm.
 * User: zl
 * Date: 2017/5/11
 * Time: 9:38
 * 描述:获取出差类型的PHP文件
 */


    require_once('../SQLBase.php');
    require_once('../Common.php');

    $conn = new SQLBase();

    $query = 'SELECT * FROM business_type';

    $result = $conn->queryData($query);

    $result_array = array();

    if($result->num_rows == 0)
        $result_array['state'] = 0;
    else{
        $result_array['state'] = 1;
        for($i = 0; $i < $result->num_rows; $i++){
            $data = $result->fetch_array();
            $result_array['data'][$i] = array('type_id'=>$data['Id'], 'type_name'=>$data['type_name']);
        }
    }

    echo json_encode($result_array);
?>